<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		ScriptPlanet.eu															/
/	Site:			http://www.scriptplanet.eu												/
/	Email:			support@scriptplanet.eu													/
/	Support:		http://www.scriptplanet.eu/support										/
/	Copyright:		2011 (c) ScriptPlanet.eu												/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0001																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla Security
defined('_JEXEC') or die;
JHTML::_('behavior.mootools');
jimport('joomla.application.component.helper');
if(JComponentHelper::isEnabled('com_joosam', true)): ?>
	<div id="jsamEvent"></div>
	<script>
	/*********************************************************

		Name: jsam_mod_event
		Version: 1.0
		Script: JavaScript
		Created by: ScriptPlanet.eu - Paules
		Site: http://www.scriptplanet.eu
		Description:	This script will use ajax to show
						information about the events you can
						set in joosam component.

	*********************************************************/
	// make ajax object
	function jsamEvenObject(){ var req; if(window.XMLHttpRequest){ req = new XMLHttpRequest(); } else if(window.ActiveXObject){ req = new ActiveXObject("Microsoft.XMLHTTP"); } else{ alert("Your Browser Does Not Support This Script - Please Upgrade Your Browser ASAP"); } return req; }
	// var that load the objects
	var jsamEve = jsamEvenObject();
	// ajax load php for event
	function jsamEvenSend(url){ jsamEve.open('post', url ,true); jsamEve.onreadystatechange = jsamEvenHandleResponse; jsamEve.send(null); }
	// on ready jsam event
	function jsamEvenHandleResponse(){ if(jsamEve.readyState == 4 && jsamEve.status == 200){ var response = jsamEve.responseText; if(response){ document.getElementById("jsamEvent").innerHTML = response; } } }
	// set auto refresh for event - 10min
	function jsamEvenRefresh(){ jsamEvenSend("<?php echo JRoute::_('index.php?option=com_joosam&view=modules&layout=event&format=raw'); ?>"); setTimeout('jsamEvenRefresh()', 20000); }
	// window onload for event
	window.onload = jsamEvenRefresh();
	</script>
<?php else: ?>
	<div id="jsamEvent">
		<div style="background:white; color:red; font-weight:bold; border-radius:10px; margin:1px; text-align:center; padding:0;">
			Component joosam is not installed.
		</div>
	</div><?php
endif;
?>